package com.H1023.service;

import com.H1023.dao.LoginMapper;
import com.H1023.pojo.Admin;
import com.H1023.pojo.Reader;
import org.junit.Test;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;


public class LoginServiceImpl implements LoginService{
    private LoginMapper loginMapper;
    public void setLoginMapper(LoginMapper loginMapper) {
        this.loginMapper = loginMapper;
    }

    public Reader login(Map<String, String> map) {
        return loginMapper.login(map);
    }

    public int register(Map<String, String> map) {
        if(loginMapper.login(map)!=null)
            return -1;
        else return loginMapper.register(map);
    }

    public Admin adminLogin(Map<String, String> map) {
        return loginMapper.adminLogin(map);
    }

    public int adminRegister(Map<String, String> map) {
        return loginMapper.adminRegister(map);
    }

}
